# TypeScript Proxy Generator

Project site: [tsproxy.codeplex.com](http://tsproxy.codeplex.com/)
Author: Kirsten Kluge

## Models

Every model in your API, you want to have in your TS Client, must have the following attribute:

`[TSGen(TSGenTag.ClientModel)]`

There has to be a ".tt" file (T4 Template) in your client with the following content:

`<#@ include file="$(ProjectDir)TypeScriptProxyGenerator\ServerModels.ttinclude" #>`

The name of this file will also be the name for the generated ".ts" file.
For example: `ServerModels.tt` will result in `ServerModels.ts`

## Proxy

Controllers that should be available in your client must have the following attribute:

`[TSGen(TSGenTag.ServerProxy)]`

Every method in this controller will be generated within your client. Individual methods can be ignored by adding the following attribute to them:

`[TSGen(TSGenTag.Ignore)]`

Also place ".tt" where you like your proxy to be generated.
There are two different generators for the proxy:

### Angular

This will generate a proxy based on AngularJS without a dependency to jQuery.

`<#@ include file="$(ProjectDir)TypeScriptProxyGenerator\ServerProxyAngular.ttinclude" #>`


### jQuery

This will generate a proxy based on jQuery 

`<#@ include file="$(ProjectDir)TypeScriptProxyGenerator\ServerProxy.ttinclude" #>`

# Generate files

To generate the ".ts" files you can right click on the ".tt" file and select "Run custom tool".

You also can do: "BUILD" > "Transform all T4 Templates" and all files in your solution will be generated.